<?php
	include("scripts/data.php");
	include("scripts/lageplan.php");
?>
<html>
<head>
	<title>Test</title>
	<link rel="stylesheet" type="text/css" href="style/style.css">
</head>
<body>
<h1>Family Finder</h1>
<form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="get">
Gruppenname: <input type="text" width="50" name="search" /> <input type="submit" value="suchen" />
</form>
<?php
$arr = get_defined_vars();

$path = "db/daten.csv";
if(isset($_GET["search"]))
{
	$group = $_GET["search"];
	$group_data = get_group_data_as_array($path,$group);
	$s_data = get_group_start_point($group_data);
	echo "<table>";
	echo "<tr><td>Name</td><td>L&auml;ngengrad</td><td>Breitengrad</td><td>Zeit</td><td>H&ouml;he</td></tr>";
	echo "<tr><td>Startpunkt</td><td>".$s_data[2]."</td><td>".$s_data[3]."</td><td>".gmdate("d.m.Y H:i:s",$s_data[4]/1000)."</td><td>".$s_data[5]."</td></tr>";
	unset($s_data);
	foreach($group_data as $member) {
		echo "<tr><td>".$member[0]."</td><td>".$member[2]."</td><td>".$member[3]."</td><td>".gmdate("d.m.Y H:i:s",$member[4]/1000)."</td><td>".$member[5]."</td></tr>";
		$coordinates[] = $member;
	}
	echo "</table>";
	unset($group_data);	
	get_group_data_as_csv($path, $group);
	if(isset($coordinates)) {
		generate_lageplan($coordinates);
	}
}
?>
</body>
</html>

